//
//  XLBaseTabBarController.m
//  industry
//
//  Created by xl on 2020/11/11.
//  Copyright © 2020 Haier. All rights reserved.
//

#import "XLBaseTabBarController.h"
#import "XLHomeVC.h"
#import "XLScheduleVC.h"
#import "XLMessageVC.h"
#import "XLUserCenterVC.h"
#import "YQMainTabBar.h"

@interface XLBaseTabBarController ()

@end

@implementation XLBaseTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setValue:[YQMainTabBar new] forKey:@"tabBar"];
   
   
}

#pragma mark - Private
-(void)addChildVC:(UIViewController*)vc title:(NSString*)title imageName:(NSString*)imageName selectImageName:(NSString*)selectImageName{
    vc.tabBarItem.title = title;
    vc.tabBarItem.image = [XLIMAGE(imageName) imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
    vc.tabBarItem.selectedImage = [XLIMAGE(selectImageName) imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.tabBar.tintColor = [UIColor blueFontColor];
    [self addChildViewController:vc];
}

- (void)tabBarWithStaff:(BOOL) isStaff{
    
    if (isStaff) {
        XLHomeVC *homeVC = [[XLHomeVC alloc] init];
        [self addChildVC:homeVC title:@"首页" imageName:@"icon_home_n" selectImageName:@"icon_home_s"];
        XLScheduleVC *scheduleVC = [[XLScheduleVC alloc] init];
        [self addChildVC:scheduleVC title:@"待办事项" imageName:@"icon_wait_n" selectImageName:@"icon_wait_s"];
        XLMessageVC *messageVC = [[XLMessageVC alloc] init];
        [self addChildVC:messageVC title:@"消息" imageName:@"icon_message_n" selectImageName:@"icon_message_s"];
        XLUserCenterVC *centerVC = [[XLUserCenterVC alloc] init];
        [self addChildVC:centerVC title:@"我的" imageName:@"icon_my_n" selectImageName:@"icon_my_s"];
    }else{
        XLHomeVC *homeVC = [[XLHomeVC alloc] init];
        [self addChildVC:homeVC title:@"首页" imageName:@"icon_home_n" selectImageName:@"icon_home_s"];
        XLMessageVC *messageVC = [[XLMessageVC alloc] init];
        [self addChildVC:messageVC title:@"消息" imageName:@"icon_message_n" selectImageName:@"icon_message_s"];
        XLUserCenterVC *centerVC = [[XLUserCenterVC alloc] init];
        [self addChildVC:centerVC title:@"我的" imageName:@"icon_my_n" selectImageName:@"icon_my_s"];
    }
    
    
    
}

+ (instancetype)tabBarWithStaff:(BOOL) isStaff{
    
    XLBaseTabBarController * tabbar = [[self alloc]init];
    [tabbar tabBarWithStaff:isStaff];
    return  tabbar;
    
}

@end
